<template>
	<view>
		<view class="head">如果没有物流信息，则可不选择</view>
		<view class="logistics" @click="gokuai">
			<view class="logisticsLeft">物流公司</view>
			<view class="logisticsCenter">{{ kuaidi }}</view>
			<view class="logisticsLeftRight"><image src="../../static/images/arrow_right.png" mode=""></image></view>
		</view>
		<view class="logistics">
			<view class="logisticsLeft">物流公司</view>
			<view class="logisticsCenter"><input type="text" value="" placeholder="请输入物流单号" v-model="dingnumber" /></view>
			<view class="logisticsLeftRight"><image src="../../static/images/202010130319.png" mode="" style="width: 44rpx; height: 44rpx;"></image></view>
		</view>
		<!-- 	<view class="heads">
			<view class="box-l">
				<view class="box-t">
			短信通知：
				</view>
				<view class="box-b">
				顺丰快递
				</view>
				</view>
			<view class="box-r">
				<view><switch checked @change="switch1Change" /></view>
			</view>
		</view> -->
		<button type="primary" @click="fahuo">确认发货</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			kuaidi: '',
			arry: {},
			add: '',
			operate_type: 4,
			customer_id: '',
			operate_id: 0,
			dingnumber:'',
			adb:{}
		};
	},
	onShow() {
		this.add = uni.getStorageSync('adx');
		// console.log(this.add);
		this.customer_id = this.add.customer_id;
		// console.log(this.customer_id);
		this.kuaidi = uni.getStorageSync('kuaidi');
		this.arry = uni.getStorageSync('fahuo');
// console.log(this.add);
let c=[]
console.log(this.add);
	
this.add.forEach(item=>{
		
	item.product_list.forEach(item=>{
		c.push(item)
	})
})

// console.log(c);
	},
	methods: {
		switch1Change: function(e) {
			console.log('switch1 发生 change 事件，携带值为', e.target.value);
		},
		gokuai() {
			uni.navigateTo({
				url: '../shop/order/logistics'
			});
		},
		fahuo() {

			this.adb.forEach(item=>{
				item.customer_id=this.customer_id
				item.delivery_name=this.kuaidi
				item.delivery_no=this.dingnumber
				item.operate_id=this.operate_id
				item.operate_type=this.operate_type
			})
			console.log(this.adb);
			this.$ajax('api/v1.stock/add', {
				0:JSON.stringify(this.adb)
			})
				.then(res => {
					// console.log(res);
					uni.navigateTo({
						url:'clientPage'
					})
				})
				.catch(res => {
					console.log(Error);
				});
		}
	}
};
</script>

<style lang="less">
page {
	background-color: #f7f4f8;
}
.head {
	height: 88rpx;
	line-height: 88rpx;
	padding-left: 30rpx;
	font-size: 28rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: rgba(102, 102, 102, 1);
}
.logistics {
	height: 110rpx;
	line-height: 110rpx;
	font-size: 30rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: rgba(51, 51, 51, 1);
	background-color: #ffffff;
	display: flex;
	padding: 0 30rpx;
	justify-content: space-between;
	margin-bottom: 20rpx;
	.logisticsLeftRight {
		image {
			width: 18rpx;
			height: 33rpx;
			vertical-align: middle;
		}
	}
	.logisticsCenter {
		position: relative;
		left: -40rpx;
		input {
			margin-top: 30rpx;
			position: relative;
			left: 110rpx;
		}
	}
}
switch {
	transform: scale(0.8);
}
.heads {
	height: 157rpx;
	background-color: #ffffff;
	margin-top: 29rpx;
	padding: 30rpx 40rpx;
	display: flex;
	justify-content: space-between;
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: rgba(51, 51, 51, 1);
	box-sizing: border-box;
	.box-b {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #666666;
		margin-top: 19rpx;
	}
}
button {
	position: fixed;
	width: 100%;
	bottom: 0;
}
</style>
